#ifndef IP_H
#define IP_H

#include <sys/types.h>
#include <netinet/in.h>

#define	IP_MAXPACKET	65535		// maximum packet size

struct ip
{
    u_int8_t ip_vhl; //IP version and IP header length
#define IP_V(ip) (((ip)->ip_vhl & 0xF0) >> 4)
#define IP_HL(ip) ((ip)->ip_vhl & 0x0F)
    u_int8_t ip_tos;    //type of service
    u_int16_t ip_len;   //length of IP packet
    u_int16_t ip_id;    //identification
    u_int16_t ip_off;   //fragment offset field
#define	IP_RF 0x8000			// reserved fragment flag
#define	IP_DF 0x4000			// dont fragment flag
#define	IP_MF 0x2000			// more fragments flag
#define	IP_OFFMASK 0x1fff		// mask for fragmenting bits
    u_int8_t ip_ttl;    //TTL
    u_int8_t ip_p;      //protocol
    u_int16_t ip_cksum; //checksum
    struct in_addr ip_src,ip_dst;   //source IP, destination IP
};

#endif // IP_H
